#include<list>
#include<iostream>
#include<vector>
#include<algorithm>

#include"List_3.h"

using namespace std;

void test1()
{
	wx::list<int> li = { 1,2,3,4,5,6,7,8 };
	auto it = li.begin();
	while (it != li.end())
	{
		cout << *it << " ";
		it++;
	}
	cout << endl;

	auto it1 = li.rbegin();
	while (it1 != li.rend())
	{
		cout << *it1 << " ";
		it1++;
	}
	cout << endl;
}

void test_op1()
{
	srand(time(0));
	const int N = 1000000;

	list<int> lt1;
	vector<int> v;
	list<int> lt2;


	for (int i = 0; i < N; ++i)
	{
		auto e = rand() + i;
		lt1.push_back(e);
		lt2.push_back(e);
	}

	int begin1 = clock();
	for (auto& e : lt2)
	{
		v.push_back(e);
	}
	lt2.clear();
	sort(v.begin(), v.end());
	for (auto& e : v)
	{
		lt2.push_back(e);
	}
	int end1 = clock();

	int begin2 = clock();
	lt1.sort();
	int end2 = clock();

	printf("vector sort:%d\n", end1 - begin1);
	printf("list sort:%d\n", end2 - begin2);
}

int main()
{
	test1();
	return 0;
}